<me:UIGSC x:Class="WPFExcelReport.TGSCOLOR"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                     xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:BOM="clr-namespace:WPFExcelReport;assembly=TGASTGA" 
                    xmlns:GS="clr-namespace:WPFExcelReport;assembly=TGSDAT" 
                    xmlns:GM="clr-namespace:WPFExcelReport;assembly=TGSMATK"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization" 
                    x:Name="TV"
                  IsPage="True"
                    Rows="100"
                    Loaded="Window_Loaded"
     >
    <me:UIGSC.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby10000  x:Key="dw"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PreisConverter  x:Key="PreisConverter"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIGSC.Resources>
    <Grid  >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="300"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <StackPanel  Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
            <WrapPanel >
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20"
                             IsEnabled="{Binding IsCanChg,ElementName=TV}"
                             >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanDelete,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" IsEnabled="{Binding IsCanCopy,ElementName=TV}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"
                               IsEnabled="{Binding IsCanCopy,ElementName=TV}"
                               >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <WrapPanel>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=纱线编号}}"/>
                    <ex:TXT72 Text="{Binding ART,ElementName=TV}" Width="200" MaxLength="20" CharacterCasing="Upper"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=色号}}"/>
                    <ex:TXT72 Text="{Binding FARBE,ElementName=TV}"  MaxLength="10" Width="100" CharacterCasing="Upper"/>
                    <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
            <WrapPanel>
                <WrapPanel IsEnabled="{Binding IsCopy,ElementName=TV}">
                    <TextBlock Text="{Binding Source={Localization:Translate Word=新色号}}"/>
                    <ex:TXT72 Text="{Binding ART,ElementName=TV}"  MaxLength="20" Width="140" CharacterCasing="Upper"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=var}}"/>
                    <ex:TXT72 Text="{Binding VAR,ElementName=TV}" MaxLength="3" />
                    <GS:TSGS01 KEY="{Binding CART,ElementName=TV}"
                               IsEdit="True"
                               />
                    <ex:TXT72 Text="{Binding FARBE,ElementName=TV}"  MaxLength="10" Width="100" CharacterCasing="Upper"/>
                    <Button   Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
                <WrapPanel IsEnabled="{Binding IsNew,ElementName=TV}">
                    <ex:TXT72 Text="{Binding ART,ElementName=TV}"  MaxLength="20" Width="140" CharacterCasing="Upper"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=var}}"/>
                    <ex:TXT72 Text="{Binding VAR,ElementName=TV}" MaxLength="3" />
                    <GS:TSGS01 IsEdit="True" KEY="{Binding CART,ElementName=TV}"/>
                    <TextBlock Text="{Binding Source={Localization:Translate Word=新色号}}"/>
                    <ex:TXT72 Text="{Binding FARBE,ElementName=TV}"  MaxLength="10" Width="100" CharacterCasing="Upper"/>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel>
            <me:TGS07  x:Name="cBS07"
                      IsAuto="{Binding IsAuto,ElementName=TV}"
                      IsEdit="{Binding IsEdit,ElementName=TV}"
                      IsSaved="{Binding IsSaved,ElementName=TV}"                      
                      KEY="{Binding ORDERNUM,ElementName=TV}"
                       ORDERNUM="{Binding KEY,ElementName=TV}" 
                       DES="{Binding DES,ElementName=TV}" 
                      />
        </StackPanel>
        <DataGrid   Grid.Row="1"   Grid.Column="0"   
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   IsReadOnly="True"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"   
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster"  
                   RowDetailsVisibilityMode="Visible"  
                    >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=GSCART}" Header="{Binding Source={Localization:Translate Word=纱线}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCVAR}" Header="{Binding Source={Localization:Translate Word=var}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSHANDLNR,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=描述}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCFARBE}" Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCBEZ,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=色名}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSNUMART}" Header="{Binding Source={Localization:Translate Word=纱支类型}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSGARNNR,Converter={StaticResource ResourceKey=dw}}" Header="{Binding Source={Localization:Translate Word=纱支}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSFACH}" Header="{Binding Source={Localization:Translate Word=股数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSRECHNUM}" Header="{Binding Source={Localization:Translate Word=计算}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSRECHNR,Converter={StaticResource ResourceKey=dw}}" Header="{Binding Source={Localization:Translate Word=纱支}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSAENDBEN}" Header="{Binding Source={Localization:Translate Word=纱线修改}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSAENDDAT}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSNEUBEN }" Header="{Binding Source={Localization:Translate Word=新建}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSNEUDAT }" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCAENDBEN}" Header="{Binding Source={Localization:Translate Word=色号修改}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCAENDDAT}" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCNEUBEN }" Header="{Binding Source={Localization:Translate Word=新建}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GSCNEUDAT }" Header="{Binding Source={Localization:Translate Word=日期}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid>
        <ex:TPage  Grid.Row="2"  Grid.Column="0"   
                   Visibility="{Binding IsPage,Converter={StaticResource bv}}"/>

        <Grid Grid.Row="1" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <GS:TGS03 Grid.Row="0" Name="cBS03" 
                       ORDERNUM="{Binding KEY,ElementName=TV}"
                      />
        </Grid>
        <Grid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/> 
            </Grid.ColumnDefinitions>

            <BOM:TGGS08 Grid.Column="1"
                       IsAuto="True" 
                       EXAUF="{Binding KEY,ElementName=cBS07}"
                       />
        </Grid>
        <Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <TextBlock  Grid.Row="0"   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=纱线}}"/>
            <me:TVGS08 Grid.Row="1"   Grid.Column="0"
                   EXAUF="{Binding KEY,ElementName=TV}" />
            <TextBlock  Grid.Row="0"   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=经纱}}"/>
            <me:TVBS08 Grid.Row="1"   Grid.Column="1"
                   EXAUF="{Binding KEY,ElementName=TV}" 
                          />
            <TextBlock  Grid.Row="0"   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=纬纱}}"/>
            <me:TVWS33 Grid.Row="1"  Grid.Column="2"
                   EXAUF="{Binding KEY,ElementName=TV}"  
                                />
        </Grid> 
    </Grid>
</me:UIGSC>
